package com.nfIt.servlet;

import com.nfIt.User;
import com.nfIt.service.Impl.UserServiceImpl;
import com.nfIt.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * ClossName:SelectAllUserServlet
 * Pakage:com.nfIt.servlet
 * Description
 *
 * @Author L
 * @Create 2024/4/25 19:14
 * @Version 2023.1.3
 */
@WebServlet("/SelectAllUserServlet")

public class SelectAllUserServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");

        UserService userService = new UserServiceImpl();
        List<User> allUser = userService.findAllUser();

        resp.getWriter().print(allUser);
    }
}
